//
//  CommentCell.m
//  Four_Fit_New
//
//  Created by lanou on 16/7/15.
//  Copyright © 2016年 xmaz. All rights reserved.
//

#import "CommentCell.h"
#import "comment.h"

////define this constant if you want to use Masonry without the 'mas_' prefix
//#define MAS_SHORTHAND
////define this constant if you want to enable auto-boxing for default syntax
//#define MAS_SHORTHAND_GLOBALS
//#import "Masonry.h"

@interface CommentCell ()
@property (weak, nonatomic) IBOutlet UILabel *sendernickname;
@property (weak, nonatomic) IBOutlet UIImageView *senderpic;
@property (weak, nonatomic) IBOutlet UILabel *createtime;
@property (weak, nonatomic) IBOutlet UIButton *content;


@end

@implementation CommentCell

- (void)awakeFromNib {
    
//    [self.senderpic layoutIfNeeded];
    self.senderpic.layer.cornerRadius = self.senderpic.frame.size.width * 0.5;
    
    self.layer.masksToBounds = YES;
}

- (void)setComment:(comment *)comment {
    
    _comment = comment;
    
    [self.senderpic sd_setImageWithURL:[NSURL URLWithString:comment.senderpic]];
    self.sendernickname.text = comment.sendernickname;
    self.createtime.text = comment.createtime;
    
    [self.content setTitle:comment.content forState:UIControlStateNormal];
    self.content.titleLabel.numberOfLines = 0;
    
    [self.content layoutIfNeeded];
    //设置按钮的高度就是titleLabel的高度？？
//    [self.content updateConstraints:^(MASConstraintMaker *make) {
//        CGFloat buttonH = self.content.titleLabel.frame.size.height + 30;
//        make.height.equalTo(buttonH);
//    }];
//    //强制更新textButton的高度
//    [self.content layoutIfNeeded];
//    //计算当前cell的高度
//    CGFloat buttonMaxY = CGRectGetMaxY(self.content.frame);
    
//    self.comment.cellHeight = buttonMaxY + 10;
    
    
    
    
}

@end
